package spotGUI.firstRunGUI;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Toolkit;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

import javax.swing.ImageIcon;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;
import javax.swing.SwingConstants;
import javax.swing.border.EmptyBorder;
import java.util.ResourceBundle;

public class FirstRunFrame extends JDialog {


	private JTabbedPane tabbedPane;
	private JPanel welcomePanel;
	private JPanel ethicsPanel;
	private JPanel whatIsPanel;
	private JPanel registrationPanel;
	private JPanel supportPanel;
	private JLabel upLabel;
	private JLabel image;


	public FirstRunFrame(int id, boolean exitOnClose) {

		if (exitOnClose == true) {
			addWindowListener(new WindowAdapter() {
				@Override
				public void windowClosing(WindowEvent e) {
					System.exit(0);
				}
			});
		}
		
		setSize(650, 499);
		setLocationRelativeTo(null);
		setResizable(false);
		setIconImage(Toolkit.getDefaultToolkit().getImage(FirstRunFrame.class.getResource("/images/Icons/64x64/users_comments.png")));
		setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);

		welcomePanel = new WelcomePanel();
		ethicsPanel = new EthicsPanel();
		whatIsPanel= new WhatIsPanel();
		registrationPanel = new RegistrationPanel(id);
		supportPanel = new SupportPanel();

		tabbedPane = new JTabbedPane(JTabbedPane.TOP);
		tabbedPane.setBorder(null);

		tabbedPane.add(welcomePanel);
		tabbedPane.add(ethicsPanel);
		tabbedPane.add(whatIsPanel);
		tabbedPane.add(supportPanel);
		tabbedPane.add(registrationPanel);
		tabbedPane.setTitleAt(0, ResourceBundle.getBundle("spotGUI.firstRunGUI.messages").getString("FirstRunFrame.1"));
		tabbedPane.setTitleAt(1, ResourceBundle.getBundle("spotGUI.firstRunGUI.messages").getString("FirstRunFrame.2"));
		tabbedPane.setTitleAt(2, ResourceBundle.getBundle("spotGUI.firstRunGUI.messages").getString("FirstRunFrame.3"));
		tabbedPane.setTitleAt(3,ResourceBundle.getBundle("spotGUI.firstRunGUI.messages").getString("FirstRunFrame.4"));
		tabbedPane.setTitleAt(4, ResourceBundle.getBundle("spotGUI.firstRunGUI.messages").getString("FirstRunFrame.5"));

		getContentPane().add(tabbedPane, BorderLayout.CENTER);

		upLabel = new JLabel(ResourceBundle.getBundle("spotGUI.firstRunGUI.messages").getString("FirstRunFrame.upLabel.text")); //$NON-NLS-1$ //$NON-NLS-2$
		upLabel.setBorder(new EmptyBorder(7, 10, 0, 0));
		upLabel.setFont(new Font("Agency FB", Font.BOLD, 26));
		upLabel.setHorizontalTextPosition(SwingConstants.LEFT);
		upLabel.setHorizontalAlignment(SwingConstants.LEFT);
		getContentPane().add(upLabel, BorderLayout.NORTH);
		
		image = new JLabel("");
		image.setIcon(new ImageIcon(FirstRunFrame.class.getResource("/images/GUIBackgrounds/wavesForFirstRun.png")));
		getContentPane().add(image, BorderLayout.SOUTH);

		setVisible(true);

	}


	protected JTabbedPane getTabbedPane() {
		return tabbedPane;
	}


}
